home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 1998 November / IRIX 6.5.2 Base Documentation November 1998.img / usr / share / catman / p_man / cat3 / perl5 / IO::Pipe.z / IO::Pipe
Text File  |  1998-10-30  |  3KB  |  133 lines

  1.  
  2.  
  3.  
  4. IIIIOOOO::::::::PPPPiiiippppeeee((((3333))))                                                        IIIIOOOO::::::::PPPPiiiippppeeee((((3333))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      IO::pipe - supply object methods for pipes
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.              use IO::Pipe;
  13.  
  14.              $pipe = new IO::Pipe;
  15.  
  16.              if($pid = fork()) { # Parent
  17.                  $pipe->reader();
  18.  
  19.                  while(<$pipe> {
  20.                      ....
  21.                  }
  22.  
  23.              }
  24.              elsif(defined $pid) { # Child
  25.                  $pipe->writer();
  26.  
  27.                  print $pipe ....
  28.              }
  29.  
  30.              or
  31.  
  32.              $pipe = new IO::Pipe;
  33.  
  34.              $pipe->reader(qw(ls -l));
  35.  
  36.              while(<$pipe>) {
  37.                  ....
  38.              }
  39.  
  40.  
  41. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  42.      IO::Pipe provides an interface to createing pipes between processes.
  43.  
  44. CCCCOOOONNNNSSSSTTTTRRRRCCCCUUUUTTTTOOOORRRR
  45.      new ( [READER, WRITER] )
  46.          Creates a IO::Pipe, which is a reference to a newly created symbol
  47.          (see the Symbol package). IO::Pipe::new optionally takes two
  48.          arguments, which should be objects blessed into IO::Handle, or a
  49.          subclass thereof. These two objects will be used for the system call
  50.          to pipe. If no arguments are given then method handles is called on
  51.          the new IO::Pipe object.
  52.  
  53.          These two handles are held in the array part of the GLOB until either
  54.          reader or writer is called.
  55.  
  56. MMMMEEEETTTTHHHHOOOODDDDSSSS
  57.      reader ([ARGS])
  58.          The object is re-blessed into a sub-class of IO::Handle, and becomes
  59.          a handle at the reading end of the pipe. If ARGS are given then fork
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. IIIIOOOO::::::::PPPPiiiippppeeee((((3333))))                                                        IIIIOOOO::::::::PPPPiiiippppeeee((((3333))))
  71.  
  72.  
  73.  
  74.          is called and ARGS are passed to exec.
  75.  
  76.      writer ([ARGS])
  77.          The object is re-blessed into a sub-class of IO::Handle, and becomes
  78.          a handle at the writing end of the pipe. If ARGS are given then fork
  79.          is called and ARGS are passed to exec.
  80.  
  81.      handles ()
  82.          This method is called during construction by IO::Pipe::new on the
  83.          newly created IO::Pipe object. It returns an array of two objects
  84.          blessed into IO::Pipe::End, or a subclass thereof.
  85.  
  86. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  87.      the _I_O::_H_a_n_d_l_e manpage
  88.  
  89. AAAAUUUUTTTTHHHHOOOORRRR
  90.      Graham Barr <bodg@tiuk.ti.com>
  91.  
  92. CCCCOOOOPPPPYYYYRRRRIIIIGGGGHHHHTTTT
  93.      Copyright (c) 1996 Graham Barr. All rights reserved. This program is free
  94.      software; you can redistribute it and/or modify it under the same terms
  95.      as Perl itself.
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.